"use strict"; // 使用严格模式

import { getArtsData, getTodosData } from "@/api";

export default {
  namespaced: true,
  state: {
    arts: []
  },
  getters: {},
  mutations: {
    SET_ARTS(state, payload) {
      // console.log(payload)
      state.arts = payload;
    }
  },
  actions: {
    async getTodo() {
      const res = await getTodosData();
      console.log(res);
    },
    async getArts({ commit }) {
      const res = await getArtsData();
      commit("SET_ARTS", res.data);
      // console.log(res.data)
      /*await axios({
        url: "http://localhost:3000/articles"
      }).then(res => {
        commit("SET_ARTS", res.data);
        // console.log('=========')
        // console.log(res)
        // console.log('=========')
      });*/
    }
  }
};
